local zhengbian = fk.CreateSkill {
  name = "lingling__zhengbian",
}

Fk:loadTranslationTable {
  ["lingling__zhengbian"] = "征边",
  [":lingling__zhengbian"] = "回合开始时，你可以视为对攻击范围内的一名角色使用火【杀】，若造成伤害，其视为使用【杀】。",

  ["#lingling__zhengbian-invoke"] = "征边：选择一名角色，视为对其使用一张火【杀】！",
  ["#lingling__zhengbian-use"] = "征边：视为使用一张【杀】！",
}

zhengbian:addEffect(fk.TurnStart, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(zhengbian.name) and
        player:canUse(Fk:cloneCard("slash"), { bypass_times = true })
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room.alive_players, function(p)
      return player:inMyAttackRange(p)
    end)
    if #targets == 0 then return false end
    local tos = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = 1,
      targets = targets,
      skill_name = zhengbian.name,
      prompt = "#lingling__zhengbian-invoke",
      cancelable = true,
    })
    if #tos == 1 then
      event:setCostData(self, { to = tos[1] })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).to
    local use = room:useVirtualCard("fire__slash", nil, player, to, zhengbian.name, true)
    if use and use.damageDealt then
      room:askToUseVirtualCard(to, {
        name = "slash",
        skill_name = zhengbian.name,
        prompt = "#lingling__zhengbian-use",
        cancelable = false,
        extra_data = {
          bypass_times = true,
          extraUse = true,
        },
      })
    end
  end,
})

return zhengbian
